﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Mechanical;
using Autodesk.Revit.DB.Plumbing;
using Autodesk.Revit.DB.Structure;
using YArchitech.LIB;

namespace YArchitech.Revit
{
	public static class RevitElementExtension
	{
		public static ElementId GetBoundarySegmentElementId(BoundarySegment inputBoundarySegment, out ElementId linkedElementId)
		{
			linkedElementId = null;
			ElementId elementId = inputBoundarySegment.ElementId;
			linkedElementId = inputBoundarySegment.LinkElementId;
			return elementId;
		}

		public static Parameter GetParameter(this Element elem, BuiltInParameter parameterId)
		{
			return elem.get_Parameter(parameterId);
		}

		public static Parameter GetParameter(this Element elem, Definition definition)
		{
			return elem.get_Parameter(definition);
		}

		public static Parameter GetParameter(this Element elem, Guid guid)
		{
			return elem.get_Parameter(guid);
		}

		public static string GetMark(this Element elem)
		{
			Parameter parameter = elem.get_Parameter(BuiltInParameter.DOOR_NUMBER);
			if (parameter == null)
			{
				return string.Empty;
			}
			return parameter.AsString();
		}

		public static string GetFamilyNameBySymbol(this FamilySymbol fs)
		{
			return fs.FamilyName;
		}

		public static Parameter GetParameter(this Element elem, string paramName)
		{
			return elem.LookupParameter(paramName);
		}

		public static Level GetYJKLevel(this Element elem)
		{
			return elem.Document.GetElementById(elem.LevelId) as Level;
		}

		public static void GetTextNotePosition(ref XYZ pt, TextAlignFlags txtAlign, double dCellHeight, double dCellWidth, double txtHeight, double dpiY, double scale)
		{
			double num = 2.0 / dpiY * 0.08333;
			if (txtAlign <= 1088)
			{
				if (txtAlign <= 640)
				{
					if (txtAlign == 576)
					{
						pt += XYZ.BasisY * dCellHeight;
						pt += XYZ.BasisX * num * scale;
						pt -= XYZ.BasisY * num * scale;
						return;
					}
					if (txtAlign == 640)
					{
						pt += XYZ.BasisX * 0.5 * dCellWidth;
						pt += XYZ.BasisY * dCellHeight;
						pt -= XYZ.BasisY * num * scale;
						return;
					}
				}
				else
				{
					if (txtAlign == 768)
					{
						pt += XYZ.BasisX * dCellWidth;
						pt += XYZ.BasisY * dCellHeight;
						pt -= XYZ.BasisX * num * scale;
						pt -= XYZ.BasisY * num * scale;
						return;
					}
					if (txtAlign == 1088)
					{
						pt += XYZ.BasisY * 0.5 * (dCellHeight + txtHeight);
						pt += XYZ.BasisX * num * scale;
						return;
					}
				}
			}
			else if (txtAlign <= 1280)
			{
				if (txtAlign == 1152)
				{
					pt += XYZ.BasisX * 0.5 * dCellWidth;
					pt += XYZ.BasisY * 0.5 * (dCellHeight + txtHeight);
					return;
				}
				if (txtAlign == 1280)
				{
					pt += XYZ.BasisX * dCellWidth;
					pt += XYZ.BasisY * 0.5 * (dCellHeight + txtHeight);
					pt -= XYZ.BasisX * num * scale;
					return;
				}
			}
			else
			{
				if (txtAlign == 2112)
				{
					pt += XYZ.BasisY * txtHeight;
					pt += XYZ.BasisX * num * scale;
					pt += XYZ.BasisY * num * scale;
					return;
				}
				if (txtAlign == 2176)
				{
					pt += XYZ.BasisY * txtHeight;
					pt += XYZ.BasisX * 0.5 * dCellWidth;
					pt += XYZ.BasisY * num * scale;
					return;
				}
				if (txtAlign == 2304)
				{
					pt += XYZ.BasisX * dCellWidth;
					pt += XYZ.BasisY * txtHeight;
					pt -= XYZ.BasisX * num * scale;
					pt += XYZ.BasisY * num * scale;
					return;
				}
			}
			pt += XYZ.BasisY * dCellHeight;
			pt += XYZ.BasisX * num * scale;
			pt -= XYZ.BasisY * num * scale;
		}

		public static XYZ GetTextNotePosition(XYZ ptText, int quar, double dH, double dWidth, View view)
		{
			XYZ xyz = ptText;
			if (quar == 1)
			{
				xyz += XYZ.BasisX * 60.0 / 304.8;
			}
			else if (quar == 3)
			{
				XYZ xyz2 = -XYZ.BasisY * dH * (double)view.Scale;
				xyz += xyz2;
			}
			else if (quar == 4)
			{
				XYZ xyz2 = -XYZ.BasisY * dH * (double)view.Scale;
				xyz += XYZ.BasisX * 60.0 / 304.8;
				xyz += xyz2;
			}
			return xyz + XYZ.BasisY * dH * (double)view.Scale * 0.8;
		}

		public static XYZ GetTextNoteCoord(TextNote txtNote)
		{
			return txtNote.Coord;
		}

		public static void SetTextNoteCoord(TextNote txtNote, XYZ ptCoord)
		{
			txtNote.Coord = ptCoord;
		}

		public static double GetTextNoteWidth(TextNote txtNote)
		{
			return txtNote.Width;
		}

		public static void SetTextNoteWidth(TextNote txtNote, double dWidth)
		{
			txtNote.Width = dWidth;
		}

		public static IEnumerable<Connector> AsEnumerable(this ConnectorSet connectorSet)
		{
			if (connectorSet != null)
			{
				return connectorSet.OfType<Connector>();
			}
			return Enumerable.Empty<Connector>();
		}

		public static IEnumerable<Connector> AsEnumerable(this ConnectorManager connectorManager)
		{
			if (connectorManager != null)
			{
				return connectorManager.Connectors.AsEnumerable();
			}
			return Enumerable.Empty<Connector>();
		}

		public static double GetDistanceTo(this Connector connector, XYZ point)
		{
			return connector.Origin.DistanceTo(point);
		}

		public static bool IsTypeMatch(this Connector connector, params ConnectorType[] connectorTypes)
		{
			return connectorTypes.Contains(connector.ConnectorType);
		}

		public static bool IsEndOrCurveOrPhysical(this Connector connector)
		{
			ConnectorType[] array = new ConnectorType[3];
			RuntimeHelpers.InitializeArray(array, fieldof(<PrivateImplementationDetails>.56B3E35ACAC6190A177A30989327863196CBE1A7).FieldHandle);
			return connector.IsTypeMatch(array);
		}

		public static bool IsSamePositionTo(this Connector connector, Connector connectorOther)
		{
			if (connector.IsConnectedTo(connectorOther))
			{
				return true;
			}
			if (connector.ConnectorType != connectorOther.ConnectorType || !connector.IsEndOrCurveOrPhysical() || !connectorOther.IsEndOrCurveOrPhysical() || !connector.Origin.IsAlmostEqualTo(connectorOther.Origin))
			{
				return false;
			}
			IEnumerable<Connector> first = connector.AllRefs.AsEnumerable().Where(new Func<Connector, bool>(RevitElementExtension.IsEndOrCurveOrPhysical));
			IEnumerable<Connector> second = connectorOther.AllRefs.AsEnumerable().Where(new Func<Connector, bool>(RevitElementExtension.IsEndOrCurveOrPhysical));
			return first.Intersect(second, new ConnectorPositionEquality()).Any<Connector>();
		}

		public static double GetAngleTo(this Connector connector, Connector connectorOther)
		{
			XYZ basisZ = connector.CoordinateSystem.BasisZ;
			XYZ basisZ2 = connectorOther.CoordinateSystem.BasisZ;
			return basisZ.AngleTo(basisZ2);
		}

		public static Connector GetConnectedConnector(this Connector connector)
		{
			if (connector == null || !connector.IsConnected)
			{
				return null;
			}
			return connector.AllRefs.AsEnumerable().FirstOrDefault((Connector c) => c.Owner.Id != connector.Owner.Id && c.IsEndOrCurveOrPhysical());
		}

		public static MEPSystemClassification GetSystemClass(this Connector connector)
		{
			if (connector == null)
			{
				return 0;
			}
			switch (connector.Domain)
			{
			case 1:
				return connector.DuctSystemType;
			case 2:
				return connector.ElectricalSystemType;
			case 3:
				return connector.PipeSystemType;
			default:
				return 0;
			}
		}

		public static string GetSystemName(this Connector connector)
		{
			if (connector != null)
			{
				return connector.MEPSystem.Name;
			}
			return "";
		}

		public static Connector GetNearestConnector(this IEnumerable<Connector> connectors, XYZ point)
		{
			if (connectors == null || !connectors.Any<Connector>())
			{
				return null;
			}
			if (connectors.Count<Connector>() == 1)
			{
				return connectors.First<Connector>();
			}
			Connector result = null;
			double num = double.MaxValue;
			foreach (Connector connector in connectors)
			{
				double distanceTo = connector.GetDistanceTo(point);
				if (distanceTo < num)
				{
					result = connector;
					num = distanceTo;
				}
			}
			return result;
		}

		public static Connector GetFarestConnector(this IEnumerable<Connector> connectors, XYZ point)
		{
			if (connectors == null || !connectors.Any<Connector>())
			{
				return null;
			}
			if (connectors.Count<Connector>() == 1)
			{
				return connectors.First<Connector>();
			}
			Connector result = null;
			double num = double.MinValue;
			foreach (Connector connector in connectors)
			{
				double distanceTo = connector.GetDistanceTo(point);
				if (distanceTo > num)
				{
					result = connector;
					num = distanceTo;
				}
			}
			return result;
		}

		public static bool HasConnectors(this Element element)
		{
			return element is MEPCurve || (element is FamilyInstance && ((FamilyInstance)element).MEPModel != null);
		}

		public static ConnectorManager GetConnectorManager(this Element element)
		{
			FamilyInstance familyInstance = element as FamilyInstance;
			if (familyInstance != null)
			{
				if (familyInstance.MEPModel != null)
				{
					return familyInstance.MEPModel.ConnectorManager;
				}
				return null;
			}
			else
			{
				MEPCurve mepcurve = element as MEPCurve;
				if (mepcurve != null)
				{
					return mepcurve.ConnectorManager;
				}
				return null;
			}
		}

		public static IEnumerable<Connector> GetConnectors(this Element element)
		{
			ConnectorManager connectorManager = element.GetConnectorManager();
			if (connectorManager != null)
			{
				return connectorManager.AsEnumerable();
			}
			return Enumerable.Empty<Connector>();
		}

		public static IEnumerable<Connector> GetConnectors(this Element element, Func<Connector, bool> predicate)
		{
			IEnumerable<Connector> connectors = element.GetConnectors();
			if (connectors != null)
			{
				return connectors.Where(predicate);
			}
			return Enumerable.Empty<Connector>();
		}

		public static IEnumerable<Connector> GetConnectors(this Element element, ConnectorType connType)
		{
			return element.GetConnectors((Connector con) => con.ConnectorType == connType);
		}

		public static Connector GetNearestConnector(this Element elem, XYZ selectPoint)
		{
			Connector result;
			try
			{
				IEnumerable<Connector> connectors = elem.GetConnectors();
				if (connectors == null || !connectors.Any<Connector>())
				{
					result = null;
				}
				else
				{
					result = connectors.GetNearestConnector(selectPoint);
				}
			}
			catch
			{
				result = null;
			}
			return result;
		}

		public static Connector GetFarestConnector(this Element elem, XYZ selectPoint)
		{
			IEnumerable<Connector> connectors = elem.GetConnectors();
			if (connectors == null || !connectors.Any<Connector>())
			{
				return null;
			}
			return connectors.GetFarestConnector(selectPoint);
		}

		public static Connector GetFirstOpenConnector(this Element elem)
		{
			IEnumerable<Connector> connectors = elem.GetConnectors();
			if (connectors != null)
			{
				return connectors.FirstOrDefault((Connector con) => !con.IsConnected);
			}
			return null;
		}

		public static string GetFamilyInstanceName(this FamilyInstance fi)
		{
			if (fi == null)
			{
				return string.Empty;
			}
			string name = fi.Name;
			return fi.Symbol.Family.Name + "/" + name;
		}

		public static bool IsCategory(this Element elem, BuiltInCategory buildInCat)
		{
			if (elem == null)
			{
				return false;
			}
			Category category = elem.Document.Settings.Categories.get_Item(buildInCat);
			return category != null && elem.Category.Name == category.Name;
		}

		public static bool IsMEPSystemObject(this Element elem)
		{
			return elem.IsDuctSystemObject() || elem.IsPipingSystemObject();
		}

		public static bool IsMEPCurve(this Element elem)
		{
			return elem is MEPCurve;
		}

		public static bool IsDuctSystemObject(this Element elem)
		{
			return elem.IsDuct() || elem.IsFlexDuct() || elem.IsDuctAccessory() || elem.IsDuctFitting() || elem.IsDuctTerminal();
		}

		public static bool IsPipingSystemObject(this Element elem)
		{
			return elem.IsPipe() || elem.IsPipeAccessory() || elem.IsPipeFitting() || elem.IsFlexPipe();
		}

		public static bool IsDuct(this Element element)
		{
			return element.IsCategory(BuiltInCategory.OST_DuctCurves);
		}

		public static bool IsFlexDuct(this Element element)
		{
			return element.IsCategory(BuiltInCategory.OST_FlexDuctCurves);
		}

		public static bool IsDuctFitting(this Element element)
		{
			return element.IsCategory(BuiltInCategory.OST_DuctFitting);
		}

		public static bool IsDuctAccessory(this Element element)
		{
			return element.IsCategory(BuiltInCategory.OST_DuctAccessory);
		}

		public static bool IsDuctTerminal(this Element element)
		{
			return element.IsCategory(BuiltInCategory.OST_DuctTerminal);
		}

		public static bool IsPipe(this Element element)
		{
			return element.IsCategory(BuiltInCategory.OST_PipeCurves);
		}

		public static bool IsFlexPipe(this Element element)
		{
			return element.IsCategory(BuiltInCategory.OST_FlexPipeCurves);
		}

		public static bool IsPipeFitting(this Element element)
		{
			return element.IsCategory(BuiltInCategory.OST_PipeFitting);
		}

		public static bool IsFixtures(this Element element)
		{
			return element.IsCategory(BuiltInCategory.OST_Fixtures);
		}

		public static bool IsPipeAccessory(this Element element)
		{
			return element.IsCategory(BuiltInCategory.OST_PipeAccessory);
		}

		public static bool IsMechanicalEquipment(this Element element)
		{
			return element.IsCategory(BuiltInCategory.OST_MechanicalEquipment);
		}

		public static MEPModel GetMEPModel(this Element element)
		{
			FamilyInstance familyInstance = element as FamilyInstance;
			if (familyInstance != null)
			{
				return familyInstance.MEPModel;
			}
			return null;
		}

		public static MEPSystemClassification GetSystemClass(this Element element)
		{
			IEnumerable<Connector> connectors = element.GetConnectors();
			if (connectors == null || !connectors.Any<Connector>())
			{
				return 0;
			}
			return connectors.FirstOrDefault<Connector>().GetSystemClass();
		}

		public static double GetConnectorMinDistanceTo(this Element elem, XYZ point)
		{
			Connector nearestConnector = elem.GetNearestConnector(point);
			if (nearestConnector != null)
			{
				return nearestConnector.Origin.DistanceTo(point);
			}
			return double.MaxValue;
		}

		public static bool ContainsSystemName(this Element elem, string systemName)
		{
			bool result = true;
			string systemName2 = elem.GetSystemName();
			if (systemName2 != null)
			{
				result = systemName2.Contains(systemName);
			}
			return result;
		}

		public static bool HasParameter(this Element elem, BuiltInParameter parameterId)
		{
			return elem.get_Parameter(parameterId) != null;
		}

		public static string GetSystemName(this Element elem)
		{
			Parameter parameter = elem.get_Parameter(BuiltInParameter.RBS_SYSTEM_NAME_PARAM);
			if (parameter == null)
			{
				return "";
			}
			return parameter.AsString();
		}

		public static bool IsDuctReturnSystem(this Element elem)
		{
			Parameter parameter = elem.get_Parameter(BuiltInParameter.RBS_DUCT_SYSTEM_TYPE_PARAM);
			if (parameter == null)
			{
				return false;
			}
			ElementId elementId = parameter.AsElementId();
			MechanicalSystem mechanicalSystem = elem.Document.GetElementById(elementId) as MechanicalSystem;
			return mechanicalSystem != null && mechanicalSystem.SystemType == 2;
		}

		private static double GetParameterValue(this Element elem, BuiltInParameter builtInParam)
		{
			Parameter parameter = elem.get_Parameter(builtInParam);
			if (parameter == null)
			{
				return 0.0;
			}
			return parameter.AsDouble();
		}

		private static void SetParameterValue(this Element elem, BuiltInParameter builtInParam, double valueImperial)
		{
			Parameter parameter = elem.get_Parameter(builtInParam);
			if (parameter != null)
			{
				parameter.Set(valueImperial);
			}
		}

		public static double GetDistance(this Element elem, BuiltInParameter builtInParam)
		{
			return UnitConvert.LengthToInternal(elem.GetParameterValue(builtInParam));
		}

		public static string GetRevitNumber(this Element elem)
		{
			if (elem is Duct || elem is Pipe || elem is FlexDuct || elem is FlexPipe)
			{
				Parameter parameter = elem.get_Parameter(BuiltInParameter.DOOR_NUMBER);
				if (parameter != null && parameter.HasValue)
				{
					return parameter.AsString();
				}
			}
			return "";
		}

		public static double GetCurveLength(this Element elem, BuiltInParameter builtInParam = BuiltInParameter.CURVE_ELEM_LENGTH)
		{
			return elem.GetDistance(builtInParam);
		}

		public static double GetVelocity(this Element elem, BuiltInParameter builtInParam = BuiltInParameter.RBS_VELOCITY)
		{
			return UnitConvert.VelocityToInternal(elem.GetParameterValue(builtInParam));
		}

		public static double GetFlow(this Element elem, BuiltInParameter builtInParam = BuiltInParameter.RBS_DUCT_FLOW_PARAM)
		{
			return UnitConvert.FlowToInternal(elem.GetParameterValue(builtInParam));
		}

		public static double GetAdditionFlow(this Element elem, BuiltInParameter builtInParam = BuiltInParameter.RBS_ADDITIONAL_FLOW)
		{
			return UnitConvert.FlowToInternal(elem.GetParameterValue(builtInParam));
		}

		public static double GetPressure(this Element elem, BuiltInParameter builtInParam)
		{
			return elem.GetParameterValue(builtInParam).PressureToInternal();
		}

		public static void SetDistance(this Element elem, BuiltInParameter builtInParam, double value)
		{
			double valueImperial = UnitConvert.LengthToStd(value);
			elem.SetParameterValue(builtInParam, valueImperial);
		}

		public static void SetVelocity(this Element elem, BuiltInParameter builtInParam, double value)
		{
			double valueImperial = UnitConvert.VelocityToStd(value);
			elem.SetParameterValue(builtInParam, valueImperial);
		}

		public static void SetFlow(this Element elem, BuiltInParameter builtInParam, double value)
		{
			double valueImperial = UnitConvert.FlowToStd(value);
			elem.SetParameterValue(builtInParam, valueImperial);
		}

		public static bool IsParallelTo(this XYZ vec1, XYZ vec2)
		{
			XYZ xyz = vec1.Normalize();
			XYZ xyz2 = vec2.Normalize();
			return xyz.IsAlmostEqualTo(xyz2) || xyz.IsAlmostEqualTo(xyz2.Negate());
		}

		public static bool IsSameDirectionTo(this XYZ vec1, XYZ vec2)
		{
			return vec1.Normalize().IsAlmostEqualTo(vec2.Normalize());
		}

		public static bool IsPerpendicularTo(this XYZ vec1, XYZ vec2)
		{
			return vec1.DotProduct(vec2) < 0.001;
		}

		public static bool IsPerpendicularTo(this XYZ vec, PlanarFace plane)
		{
			return vec.IsParallelTo(plane.Normal);
		}

		public static bool IsParallelToXYPlane(this XYZ vec)
		{
			return Math.Abs(vec.Z) < 0.001;
		}

		public static XYZ Polar(this XYZ basePoint, XYZ vec)
		{
			return basePoint + vec;
		}

		public static XYZ Polar(this XYZ basePoint, double angle, double length)
		{
			return basePoint + length * new XYZ(Math.Sin(angle), Math.Cos(angle), 0.0);
		}

		public static Curve GetCurve(this BoundarySegment segment)
		{
			return segment.Curve;
		}

		public static Element GetElement(this BoundarySegment segment, Document doc)
		{
			if (doc == null)
			{
				return null;
			}
			return segment.Element;
		}

		public static XYZ FaceNormal(this PlanarFace face)
		{
			return face.FaceNormal;
		}

		public static LeaderArray HyGetLeaders(this TextNote textNote)
		{
			LeaderArray leaderArray = null;
			leaderArray = new LeaderArray();
			foreach (Leader leader in textNote.GetLeaders())
			{
				leaderArray.Append(leader);
			}
			return leaderArray;
		}

		public static LeaderArray HyGetLeaders(this AnnotationSymbol symbol)
		{
			return symbol.GetLeaders() as LeaderArray;
		}

		public static Parameter GetUnderLayParameter(this ViewPlan viewplan)
		{
			return viewplan.GetParameter(BuiltInParameter.VIEW_UNDERLAY_ID);
		}

		public static BaseLineInfo GetBaseLineParameter(this ViewPlan viewplan)
		{
			return new BaseLineInfo
			{
				BaseLineID = viewplan.GetParameter(BuiltInParameter.VIEW_UNDERLAY_ID).AsElementId(),
				TopLevelID = viewplan.GetParameter(BuiltInParameter.VIEW_UNDERLAY_ID).AsElementId(),
				BaseLineDirection = 0
			};
		}

		public static void SetBaseLineParameter(ViewPlan viewplan, BaseLineInfo baseLineInfo)
		{
			viewplan.GetParameter(BuiltInParameter.VIEW_UNDERLAY_ID).Set(baseLineInfo.BaseLineID);
		}

		public static GridType GetGridType(this Grid grid)
		{
			return grid.Document.GetElement(grid.GetTypeId()) as GridType;
		}

		public static void HyExtendToAllLevels(this Grid grid)
		{
		}

		public static Plane GetRefPlane(this ReferencePlane refPlane)
		{
			return refPlane.GetPlane();
		}

		public static Reference PlaneReference(this Level level)
		{
			return level.GetPlaneReference();
		}

		public static void ChangeLevelType(this Level level, LevelType levelType)
		{
			level.ChangeTypeId(levelType.Id);
		}

		public static LevelType GetLevelType(this Level level, Document doc)
		{
			return doc.GetElement(level.GetTypeId()) as LevelType;
		}

		public static double GetMinimumAllowedWidth(Document doc, ElementId textNodeTypeId)
		{
			return NumbericTools.mmToFeet(1.0) / (double)doc.ActiveView.Scale;
		}

		public static double GetMaximumAllowedWidth(Document doc, ElementId textNodeTypeId)
		{
			return double.MaxValue;
		}

		public static Curve GetGridCurve(View view, Grid grid)
		{
			if (grid == null)
			{
				return null;
			}
			Curve result;
			try
			{
				IList<Curve> curvesInView = grid.GetCurvesInView(1, view);
				if (curvesInView.Count <= 0)
				{
					result = null;
				}
				else
				{
					result = curvesInView[0];
				}
			}
			catch (Exception)
			{
				result = null;
			}
			return result;
		}

		public static Curve GetLevelCurve(View view, Level level)
		{
			if (level == null)
			{
				return null;
			}
			Curve result;
			try
			{
				IList<Curve> curvesInView = level.GetCurvesInView(1, view);
				if (curvesInView.Count <= 0)
				{
					result = null;
				}
				else
				{
					result = curvesInView[0];
				}
			}
			catch (Exception)
			{
				result = null;
			}
			return result;
		}

		public static void SetRebarShapeId(this Rebar rebar, ElementId shapeId)
		{
			rebar.RebarShapeId = shapeId;
		}

		public static IList<Curve> ComputeDrivingCurves(this Rebar rebar)
		{
			return rebar.ComputeDrivingCurves();
		}

		public static void SetLayoutAsNumberWithSpacing(this Rebar rebar, int numberOfBarPositions, double spacing, bool barsOnNormalSide, bool includeFirstBar, bool includeLastBar)
		{
			rebar.SetLayoutAsNumberWithSpacing(numberOfBarPositions, spacing, barsOnNormalSide, includeFirstBar, includeLastBar);
		}

		public static double PointEqualTol = UnitConvert.LengthToStd(0.05);

		public static double AngleEqualTol = 0.034906585039886591;
	}
}
